#ifndef TEXTUREMGR_H
#define TEXTUREMGR_H

#include "Game Engine/Header/d3dUtil.h"
#include <vector>
#include <string>

class TextureMgr
{
public:
	friend TextureMgr& GetTextureMgr();
	typedef std::vector<std::wstring> StringVector;
 
	void init(ID3D10Device* device);

	// for debug
	void dumpInfo()const;

	ID3D10ShaderResourceView* getRandomTex();
	ID3D10ShaderResourceView* createTex(std::wstring filename);
	ID3D10ShaderResourceView* createTexArray(
		std::wstring arrayName, 
		const std::vector<std::wstring>& filenames);

	// .dds files can store cube textures in one file
	ID3D10ShaderResourceView* createCubeTex(std::wstring filename);
	ID3D10ShaderResourceView* mRandomTexRV;
	ID3D10RenderTargetView*             g_apEnvMapOneRTV[6];// 6 render target view, each view is used for 1 face of the env map
	ID3D10DepthStencilView*             g_pEnvMapOneDSV;    // Depth stencil view for environment map for all 1 face
	ID3D10RenderTargetView*             g_pEnvMapRTV;// 6 render target view, each view is used for 1 face of the env map
	ID3D10DepthStencilView*             g_pEnvMapDSV;    // Depth stencil view for environment map for all 1 face
	ID3D10Texture2D* g_pEnvMap;
	ID3D10Texture2D* g_pEnvMapDepth;



private:
	TextureMgr();
	TextureMgr(const TextureMgr& rhs);
	TextureMgr& operator=(const TextureMgr& rhs);
	~TextureMgr();

	void buildRandomTex();

private:
	ID3D10Device* md3dDevice;

	StringVector mTextureNames;
	std::vector<ID3D10ShaderResourceView*> mTextureRVs;

};

TextureMgr& GetTextureMgr();

#endif // TEXTUREMGR_H